import type { ProColumns } from '@ant-design/pro-table';

// 定义请求返回数据类型
export type ColumnsItem = {
  txNo: string;
  acNo: string;
  amt: number;
  custNo: string;
  sendTime: Date;
  totalDailyInvestment: number;
  status: 0 | 1;
  reason: string;
}

// 定义表头
let columnsData: ProColumns<ColumnsItem>[] = [
  {
    title: '获赠会员号',
    dataIndex: 'custNo',
    hideInTable: true,
    fieldProps: {
      maxLength: 20
    },
  },
  {
    title: '交易日期',
    dataIndex: 'created_at',
    hideInTable: true,
    valueType: 'dateRange',
    search: {
      transform: (value) => {
        return {
          startDate: value[0],
          endDate: value[1],
        };
      },
    },
  },
  {
    title: '交易流水号',
    dataIndex: 'txSerNo',
    hideInTable: true,
    fieldProps: {
      maxLength: 20
    },
  },
  {
    title: '交易结果',
    dataIndex: 'status',
    hideInTable: true,
    valueType: 'select',
    valueEnum: {
      0: {
        text: '成功',
        status: 'Success',
      },
      1: {
        text: '失败',
        status: 'Error',
      },
    },
  },

  // 上方查询，下方表头
  {
    title: '序号',
    dataIndex: 'order',
    valueType: 'indexBorder',
    width: 50,
    fixed: 'left',
    hideInSearch: true,
  },
  {
    title: '获赠会员号',
    width: 160,
    fixed: 'left',
    hideInSearch: true,
    dataIndex: 'custNo',
    ellipsis: true,
  },
  {
    title: '获赠账号',
    width: 160,
    hideInSearch: true,
    dataIndex: 'acNo',
  },
  {
    title: '参与分配总积分',
    width: 120,
    hideInSearch: true,
    dataIndex: 'totalPoint',
  },
  {
    title: '贡献度',
    width: 80,
    hideInSearch: true,
    dataIndex: 'contribution',
  },
  {
    title: '参与分配总金额',
    width: 120,
    hideInSearch: true,
    dataIndex: 'totalDailyInvestment',
  },
  {
    title: '币种',
    width: 50,
    hideInSearch: true,
    dataIndex: 'ccy1',
  },
  {
    title: '获赠金额',
    width: 120,
    hideInSearch: true,
    dataIndex: 'amt',
  },
  {
    title: '币种',
    width: 50,
    hideInSearch: true,
    dataIndex: 'ccy2',
  },
  {
    title: '交易时间',
    width: 160,
    hideInSearch: true,
    dataIndex: 'sendTime',
  },
  {
    title: '交易流水号',
    width: 180,
    hideInSearch: true,
    dataIndex: 'txSerNo',
  },
  {
    title: '交易结果',
    hideInSearch: true,
    dataIndex: 'status',
    width: 100,
    valueEnum: {
      0: {
        text: '成功',
        status: 'Success',
      },
      1: {
        text: '失败',
        status: 'Error',
      },
    },
  },
  {
    title: '失败原因',
    width: 160,
    dataIndex: 'reason',
    hideInSearch: true,
  }
]
export default columnsData;
